#!/usr/bin/python
#-*- encoding:utf-8 -*-
#
########################################
# 列表页
#
#######################################


import sys, cgi, ConfigParser, datetime, logging, os
import random
import urllib


class Index:

    def __init__(self):
       # self.oDebug = base_debug.BaseDebug();
        #self.account = base_account.BaseAccount();
        self.requesrUrl = os.environ['REQUEST_URI'];
        self.serverName = os.environ['SERVER_NAME'];
        self.login_jump_url = "%s" % ('http://' + self.serverName + self.requestUrl[:self.requestUrl.index('cgi-bin') + 8] + "elogin.py?" + urllib.urlencode({'jump_url':request_url}));
    
    def Process(self):
        account, sess = self.account.ReadCookie();
        if True:
            self.InfoLog(0, "BaseCgi.__Process:CheckSess failed, account[%s], sess[%s]"%(account, sess));
            print "Content-Type: text/html;charset=UTF-8";
            print "Location: %s\r\n" % self.login_jump_url;
            return False;
        else:
            print "Content-Type: text/html;charset=UTF-8\r\n";
            print base_template.FileRender(g_TemplateFilePath + "index.htm",{});
            return True;
        
if __name__ == '__main__':
    index = Index();
    index.Process();
